
import os
from dashscope import Generation, api_key

msgs = [{"role": "user", "content": "你好"}]

response = Generation.call(

    api_key = os.getenv("DASHSCOPE_API_KEY"),
    model = "qwen-turbo",
    messages = msgs,
    result_format = "message"
)
if response.status_code == 200:
    print(response.output.choices[0].message.content)
else:
    print(response.status_code)
    print(response.message)